{% extends "base.html" %}

{% block class %}blog{% endblock %}

{% block main %}
<h3>{{ object.title }}</h3>
<dl>
	{% load comments %}
	{% get_free_comment_count for blog.post object.id as comment_count %}

	{% load markup %}
	<dd>{{ object.body|markdown }}</dd>

	<dd>Posted on {{ object.create_date|date:"F j, Y" }}
		<a href="{{ object.get_absolute_url }}#comments" class='commentlink'>{{ comment_count }} Comment{{ comment_count|pluralize }}</a>
		Tags: 
		{% for tag in object.assoc_tags.all %}
			<a href="{{ tag.get_absolute_url }}">{{ tag.title }}</a>
			{% if not forloop.last %}, {% endif %}
		{% endfor %}			
	</dd>	

	{% get_free_comment_list for blog.post object.id as comment_list %}
	<dt id="comments">Comments</dt>
	{% for comment in comment_list %}
		<dd class="comment_{% cycle odd,even %}" id="c{{ comment.id }}">
			<span class="comnum"><a id="c{{ comment.id }}" href="#c{{ comment.id }}">#{{ forloop.counter }}</a></span>
			<p><b>{{ comment.person_name }}</b> commented, on {{ comment.submit_date|date:"F j, Y" }} at {{ comment.submit_date|date:"P" }}:</p>
			{{ comment.comment|escape|urlizetrunc:40|markdown }}
		</dd>
	{% endfor %}
	<dt>Post a comment</dt>
	{% free_comment_form for blog.post object.id %}
</dl>
{% endblock %}
